<%@ page contentType="text/html;charset=UTF-8"  %>
<%@page import="com.ufida.ebscg.comm.Constant" %>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>招商银行供应商门户-采购创造价值_商务协同_商务应答_商业机会</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<link href="../css/style_add.css" rel="stylesheet" type="text/css" />
<link href="css/collcss.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript" src="../javascript/caltimer.js"></script>
<script language="JavaScript" type="text/javascript" src="../javascript/ajaxdeal.js"></script>
</head>

<body style="width:610px">
<%if(Constant.CAOPEN){ %>
<OBJECT id="CertSignAtl"  height="0" hspace="0" width="0" align="center" classid="clsid:4FEA81CE-00EA-4FB2-850E-353C947B7A66" VIEWASTEXT>
</OBJECT>  
<%} %>


<div id="main">
<!--左侧内容开始-->
<div id="right">
  <table width="610" border="0">
    <tr>
      <td height="30" class="f-12-333333">项目名称：<span class="f-16-b-000000">${projectname}</span></td>
    </tr>
  </table>
  <table width="620" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="13"><img src="images/yingda_zbj_001.jpg" width="13" height="76" border="0" /></td>
      <td width="70" background="images/yingda_zbj_002.jpg"><img src="images/yingda_z_001.jpg" width="64" height="63" border="0" /></td>
      <td width="215" valign="top" background="images/yingda_zbj_002.jpg"><table width="215" border="0" cellpadding="0" cellspacing="0" height="62">
        <tr>
          <td height="36"  colspan="8" valign="middle" class="f-14-e57c00">距离应答截止日期还有</td>
        </tr>
        <tr>
          <td width="26" align="center" bgcolor="#e57c00" class="f-20-b-ffffff" id="day"></td>
          <td align="center" class="f-14-b-000000">天</td>
          <td width="27" align="center" bgcolor="#e57c00" class="f-20-b-ffffff" id="hour"></td>
          <td align="center" class="f-14-b-000000">时</td>
          <td width="27" align="center" bgcolor="#e57c00" class="f-20-b-ffffff" id="minute"></td>
          <td align="center" class="f-14-b-000000">分</td>
          <td width="27" align="center" bgcolor="#e57c00" class="f-20-b-ffffff" id="second"></td>
          <td align="center" class="f-14-b-000000">秒</td>
        </tr>
      </table></td>
      <td width="10" align="left" background="images/yingda_zbj_002.jpg"><img src="images/yingda_zbj_004.jpg" width="1" height="57" border="0" /></td>
      <td background="images/yingda_zbj_002.jpg" class="f-12-F60000">注意：请在应答截止时间前进行应答，超过应答截止时间后进行的应答操作为无效操作！</td>
      <td width="13"><img src="images/yingda_zbj_003.jpg" alt="" width="13" height="76" border="0" /></td>
    </tr>
  </table>
  <table width="610" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="128" height="15" ></td>
      <td width="176" ></td>
      <td width="96" ></td>
      <td width="210" ></td>
    </tr>
    <tr>
      <td height="35" align="right">邀请函标题：&nbsp;</td>
      <td align="left">${steppub.release_title }</td>
      <td align="right"> 响应截止日期：&nbsp;</td>
      <td align="left">${steppub.bid_end_ts }</td>
    </tr>
    <tr>
      <td height="35" align="right">发布时间：&nbsp;</td>
      <td align="left">${steppub.release_date }</td>
      <td height="35" align="right">发布机构：&nbsp;</td>
      <td align="left">${steppub.pk_corp }</td>
    </tr>
    <tr>
    	<td height="35" align="right">发布部门：&nbsp;</td>
      <td align="left">${steppub.pk_dept }</td>
      <td align="left">发布人：&nbsp;</td>
      <td align="left">${steppub.pk_person }</td>
    </tr>
    <tr>
      <td align="right" valign="top">内容：&nbsp;</td>
      <td colspan="3" align="left" valign="bottom"><div style="height:80px; overflow:auto;">
        <p>${steppub.release_text }</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
      </div></td>
    </tr>
    <tr>
      <td >&nbsp;</td>
    </tr>
  </table>
  
  <table width="610" border="0" cellpadding="0" cellspacing="0" height="120" class="xian">
   <tr>
          <td height="25" colspan="5" class="f-13-b-2a6ca7" >邀请文件下载</td>
      </tr>  
    <tr>
    
    <form action="invite.do" method="post" name="downfile">
    <input type="hidden" name="sign" id="sign"/>
      <td valign="middle"><table width="610" border="0" cellpadding="0" cellspacing="0">
      
        <tr class="th_bj">
          <td width="121" height="28" align="center" class="f-12-b-ffffff"  >序</td>
          <td width="146" height="28" align="center"  ><span class="f-12-b-ffffff">文件名称</span></td>
          <td width="111" height="28" align="center"  ><span class="f-12-b-ffffff">备注</span></td>
          <td width="132" height="28" align="center"  ><span class="f-12-b-ffffff">下载</span></td>
          <td width="100" height="28" align="center" class="f-12-b-ffffff"  >签名</td>
        </tr>
        
        
        <logic:iterate id="att" name="atts">
        
	         <tr>
	          <td height="35" align="center" >${att.index }</td>
	          <td align="center" >${att.filename }</td>
	          <td align="center" >&nbsp;</td>
	          <td align="center" ><img src="../images/botton_downloading.jpg" width="59" height="21" border="0" style="cursor:hand" onclick=<% if(Constant.CAOPEN){ %>downfilefun('${att.pk_da_att}','${att.filename}')<%}else{%>downfilefun('${att.pk_da_att}','${att.filename}')<%} %> /></td>
	          <td align="center" ><img src="../images/botton_signature-.jpg" width="59" height="21" border="0" style="cursor:hand"  onclick=supquoteSign('${steppub.pk_xy_step_pub}') /></td>
	        </tr>
        
        </logic:iterate>
        <tr>
          <td colspan="5" height="1" bgcolor="#7f98ae"></td>
        </tr>
        <tr>
          <td height="25" colspan="5" >&nbsp;</td>
        </tr>
        <tr>
          <td colspan="5" height="1" class="xian"></td>
        </tr>
      </table>
     </form> 
      
      </td>
    </tr>
  </table>
  
  <form action="invite.do" method="post" name="supagent">
  
  <input type="hidden" name="pk_xy_proj_main" value="${pk_xy_proj_main}"/>
  <table width="610" border="0" cellpadding="0" cellspacing="0">
    <tr >
      <td width="113" height="28" align="left"  ><span class="f-13-b-2a6ca7">供应商应答</span></td>
      <td width="197" align="center"  >&nbsp;</td>
      <td width="113" align="center"  >&nbsp;</td>
      <td width="187" align="center"  >&nbsp;</td>
    </tr>
      <tr >
      <td height="28" colspan="4" align="center"  ><table width="610" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="95" align="center">是否参加 <span class="f-12-F60000">*</span></td>
          <td width="45" align="left">
              <input type="radio" name="is_join" id="is_join" value="Y" 
               <logic:equal value="Y" name="isjoin">
            checked
            </logic:equal>
              />是 </td>
          <td width="58" align="left">
          <input type="radio" name="is_join" id="is_join" value="N" 
          <logic:equal value="N" name="isjoin">
            checked
            </logic:equal>
          
          />否</td>
          <td>&nbsp;</td>
          </tr>
      </table>
        <table width="610" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="95" align="center">是否代理 <span class="f-12-F60000">*</span></td>
            <td width="45" align="left"><input type="radio" name="is_agent" id="radio5" value="Y"  
            
            <logic:equal value="Y" name="isagent">
            checked
            </logic:equal>
            />
              是 </td>
            <td width="58" align="left"><input type="radio" name="is_agent" id="radio6" value="N" onclick="removeAllTr()"
            
             <logic:equal value="N" name="isagent">
            checked
            </logic:equal>
            
            />
              否</td>
            <td width="407">&nbsp;</td>
            </tr>
        </table>
        <table width="605" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td align="center">&nbsp;</td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td height="35" colspan="4" align="right" ><table width="610" border="0" cellpadding="0" cellspacing="0">
        <table width="610" border="0" cellpadding="0" cellspacing="0">
          <tr class="th_bj">
            <td width="200" height="28" align="center"> <span class="f-12-b-ffffff">代理商名称</span></td>
            <td width="89" height="28" align="center"  ><span class="f-12-b-ffffff">代理商联系人</span></td>
            <td width="119" height="28" align="center"  ><span class="f-12-b-ffffff">代理商联系电话</span></td>
            <td width="136" height="28" align="center"  ><span class="f-12-b-ffffff">代理商email</span></td>
			<td align="center" width="30"><img src="../images/botton_add.jpg"  border="0" onclick="addRow()" style="cursor:hand"/>
          </tr>
          
         
          </table>
          <table width="610" border="0" cellpadding="0" cellspacing="0" id="fileuploadtable">
           <logic:iterate id="supagent" name="supagents">
           <tr id="row${supagent.index }">
            <td height="35" align="center" ><input name='agent_name' type='text' id='textfield22' size='16' value='${supagent.agent_name }'/></td>
            <td align="center" ><input name='agent_person' type='text' id='textfield3' size='8' value="${supagent.agent_person}" /></td>
            <td align="center" ><input name='agent_tel' type='text' id='textfield32' size='8' value="${supagent.agent_tel}"/></td>
            <td align="center" ><input name='agent_mail' type='text' id='textfield322' size='10' value="${supagent.agent_mail}"/></td>
            <td align="center"><img src='../images/botton_delete.jpg' style='cursor:hand' border=0 style='cursor:hand' onclick="deleteRow('${supagent.index}')"/></td>
          </tr>
          <tr>
            <td colspan="5" height="1" bgcolor="#7f98ae"></td>
          </tr>
          </logic:iterate>
        </table>
        
        </td>
      </tr>
    
    <tr>
      <td colspan="4" align="right" valign="top" ><table width="100%%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="12%" align="left" valign="top">说明：</td>
          <td width="88%"><textarea name="memo" id="textarea2" cols="68" rows="10">${memo}</textarea></td>
        </tr>
      </table>          </td>
      </tr>
      <tr >
      <td width="113" height="40" align="center"  >&nbsp;</td>
      <td width="197" align="right"  ><img src="../images/botton_submit.jpg" width="60" height="20" border="0" onclick="submitValue()" style="cursor:hand"/></td>
      <td width="113" align="center"  ><img src="../images/botton_cancellation .jpg" width="60" height="20" border="0" style="cursor:hand" onclick="cancelValue()"/></td>
      <td width="187" align="center"  >&nbsp;</td>
    </tr>
  </table>
  <p class="protext" id="div_content" name="div_content"><br/>
</p>
  </div>
  </form>


<script language="vbscript">

		function downandsign(attpk,filename)
			
		Dim strPlaintext
		Dim strSignature
		Dim strCert
		Dim ret
			
		ret = 0 rem ret 必须赋初值
		
		if IsNull(CertSignAtl) then
			alert("请确认您是否有权限下载文件")
			return
		end if
		
		CertSignAtl.SignData ret, filename, strSignature
		
		If ret = 0 Then
				call downfilefun(attpk,strSignature)
		ElseIf ret = 100 Then

		Else
				Alert("下载文件出现问题")
		End If

		end function

</script>

<script language="javascript">


parent.hideHideFun();

var message = "${message}";

if(message != ""){

		parent.showHideFun();
		parent.changeShowMessage(message,'yes','ok');
}
var change  = new timechange();

//设置时间长度
change.setDistance(${dismill});

wakeInterval();


function SignFlag()
{
	this.flag = 1;
}
var sign = new SignFlag();
//使用ajax调用签名方法
function supquoteSign(pk)
{
	if(change.distance > 0)
	{
		parent.showHideFun();
		parent.changeShowMessage("开始签名!");
		var url = "invite.do?type=3&pk_xy_step_pub="+pk+"&pk_xy_proj_main=${pk_xy_proj_main}&"+Math.random();
			sign.flag = 2;
			ajax(url,returnFunction);
		
	}else{
	
			showmess("应答已过期");
	}
}

function returnFunction(value)
{
	if(value != null)
	{
		if(value == "ok")
		{
			parent.changeShowMessage("签名成功!",'yes','ok');	
		}else
		{
			parent.changeShowMessage("签名失败!",'yes','ok');	
		}
	}else
	{
		parent.changeShowMessage("签名失败!",'yes','ok');	
		
	}
}

//提交保存数据
function submitValue()
{
	if(change.distance > 0)
	{
		if(checkdata())
		{
			parent.showHideFun();
			parent.changeShowMessage("数据处理中,请等候.....");
			document.supagent.action = "invite.do?type=1";
			document.supagent.submit();
		}
	}else
	{
		showmess("应答已过期");
	}
}

//清空录入数据
function cancelValue()
{
	document.supagent.reset();
}


//下载文件
function downfilefun(attpk,filename)
{
	if(change.distance > 0)
	{
		document.downfile.sign.value = filename;
		document.downfile.action = "invite.do?pk_da_att="+attpk+"&type=2&pk_xy_proj_main=${pk_xy_proj_main}";
		document.downfile.submit();
	}
}

var rowindex=${total};
//向批量上传文件的列表中添加一行数据
function addRow()
{

	 var radioobject = document.getElementById("radio5"); 
	 
	 if(!radioobject.checked)
	 {
	 	return;
	 }
     var root = document.getElementById("fileuploadtable")
     var row = root.insertRow();
     row.style.height = '26px';
     rowindex++;
     row.id = "row"+rowindex;
     

     var cell1 = row.insertCell();
     cell1.align="center";
     cell1.innerHTML = "<input name='agent_name' type='text' id='textfield22' size='16'/>";
     

     var cell2 = row.insertCell();
     cell2.align="center";
	 cell2.innerHTML = "<input name='agent_person' type='text' id='textfield3' size='8' />";
	 
	 var cell4= row.insertCell();
	 cell4.align="center";
     var innercontent = "<input name='agent_tel' type='text' id='textfield32' size='8' />";
     cell4.innerHTML = innercontent;
     

     var cell5 = row.insertCell();
     cell5.align="center";
     cell5.innerHTML = "<input name='agent_mail' type='text' id='textfield322' size='10' />";
     

     var cell3 = row.insertCell();
     cell3.align="center";
     var img = "<img src='../images/botton_delete.jpg' style='cursor:hand' border=0 style='cursor:hand' onclick='deleteRow("+rowindex+")'/>";
     cell3.innerHTML = img;   
}

//删除上传文件
function deleteRow(index)
{
	var root = document.getElementById("fileuploadtable");
	var row = "row"+index ;
	
	var rows = root.rows;
    var deletepos = 0;
    
    
    //寻找到对应的删除行并进行删除
	for(var pos = 0; pos < rows.length; pos++)
	{
		var temprow = rows[pos];
		if(temprow.id == row)
		{
			root.deleteRow(pos);
			deletepos = pos;
			rowindex--;
			break;
		}
	}
}

function checkdata()
{
	var agent_mail = document.getElementsByName("agent_mail");
	var	agent_name = document.getElementsByName("agent_name");
	var agent_tel = document.getElementsByName("agent_tel");
    var agent_person = document.getElementsByName("agent_person");
    
    //判断代理供应商email是否填写
    if(agent_mail != null && agent_mail.length >0)
    {
      	var re = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
    	for(var index=0; index<agent_mail.length; index++)
    	{
    		
    		if(!(re.test(agent_mail[index].value)))
    		{
    			showmess("请填写正确的代理商e-mail");
    			return false;
    		}
    	}
    }
    
    //判断代理供应商用户名是否填写
    if(agent_name != null && agent_name.length >0)
    {
    	for(var index=0; index<agent_name.length; index++)
    	{
    		if(agent_name[index].value=="")
    		{
    			showmess("请填写代理商名称");
    			return false;
    		}
    	}
    }
    
     //判断代理供应商电话是否填写
    if(agent_tel != null && agent_tel.length >0)
    {
    	for(var index=0; index<agent_tel.length; index++)
    	{
    		var patrn=/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/;
    	
	    	if(!patrn.test(agent_tel[index].value))
	        {
	    			showmess("请填写正确代理商电话");
	    			return false;
	    	}
    		
    	}
    }
    
     //判断代理供应商联系人是否填写
    if(agent_person != null && agent_person.length >0)
    {
    	for(var index=0; index<agent_person.length; index++)
    	{
    		if(agent_person[index].value=="")
    		{
    			showmess("请填写代理商联系人");
    			return false;
    		}
    	}
    }
    
    return true;
}


//当选中不代理供应商时清空代理商信息
function removeAllTr()
{
	var root = document.getElementById("fileuploadtable");
	var rows = root.rows;
	
	if(rows != null)
	{
		var length = rows.length;
		for(var index=length-1; index>=0; index--)
		{
			root.deleteRow(index);
		}
	}
	
}
</script>
</body>
</html>
